<?php
$uid=isset($_COOKIE["UID"])?$_COOKIE["UID"]:"";
?>
<table width="200" border="1">
  <tr>
    <th colspan="8" scope="col">My Projects</th>
  </tr>
  <tr>
    <th scope="row">ID</th>
    <td>Name</td>
    <td>Company</td>
    <td>ReleaseTime</td>
    <td>ExpiredTime</td>
    <td>Email</td>
    <td>Description</td>
    <td>Operation</td>
  </tr>
<?php

if($uid!="")
{
   include "mysql.inc.php";
   include "user.inc.php";

   $m=new CMySQL($dbserver,$dbuser,$dbpsd,$dbname);

   $sql="select * from projects where UID=$uid";

   $prj=$m->DoQuery($sql);
   $pc=count($prj);
   if($pc==0) echo "<tr><td colspan=8>NO PROJECTS FOUND!</td></tr>";
   else
   {
      for($i=0;$i<$pc;$i++)
      {
?>
 <tr>
    <td><?php echo ($i+1);?></td>
    <td><?php echo $prj[$i]["PNAME"];?></td>
    <td><?php echo $prj[$i]["COMPANY"];?></td>
    <td><?php echo $prj[$i]["RTIME"];?></td>
    <td><?php echo $prj[$i]["ETIME"];?></td>
    <td><?php echo $prj[$i]["CEMAIL"];?></td>
    <td><?php echo $prj[$i]["MEMO"];?></td>
    <td><a href=newproject.php?type=edit&pid=<?php echo $prj[$i]["PID"];?>>Edit</a></td>
  </tr>
<?php
      }       
   }
}
else header("Location:login.php");
?>
</table>